package com.mck.mapper;

import com.mck.entity.CommonProblem;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommonProblemMapper {
    /**
     * 获取常见问题
     */
    @Select("select id, title, content, create_time, update_time from common_problem")
    List<CommonProblem> getCommonProblem();

    /**
     * 添加常见问题
     */
    @Insert("insert into common_problem(title, content, create_time, update_time) values(#{title}, #{content}, #{createTime}, #{updateTime})")
    void addCommonProblem(CommonProblem commonProblem);

    /**
     * 更新常见问题
     */
    @Update("update common_problem set title = #{title}, content = #{content}, update_time = #{updateTime} where id = #{id}")
    void updateCommonProblem(CommonProblem commonProblem);

    /**
     * 删除常见问题
     */
    @Delete("delete from common_problem where id = #{id}")
    void deleteCommonProblem(Integer id);
}
